Adding approved leave entries into a form in Zoho People
Here is our approach for adding approved leave entries into a form in Zoho People

Approach
We can get leave entries using API and add it in newly created form using custom functions
Note : |
|
|
|
Step 1. Creating new Form
1.1 Go to "Settings" ---> Tap on "Forms"

1.2 Tap on "Add New Form"

1.3 Add form name and fill up other fields too

1.4 Add a lookup field by drag and drop

1.5 Choose employee module for the lookup field and fill other required fields

1.6 Add other required fields for the form to store leave application details

Step 2. Creating custom function to add all existing approved leave entries into custom form which we created in Step 1
Note: |
1. Executes the custom function once to add already existing leave entries into newly created form and don't execute this custom function repeatedly to avoid duplication of leave entries in newly created form |
2.1 Go to "Settings" --->Tap on "Action"

2.2 Select "Custom Function"

2.3 Tap on "Add Custom Function"

2.4 Paste the code and Tap on "Save and Execute" once

Step 3. Getting AuthToken
3.1 Open the link "https://accounts.zoho.com/apiauthtoken/create?SCOPE=zohopeople/peopleapi"
3.2 Tap on the button "Generate Authtoken"

3.3 Copy the "Authtoken" generated


Code Snippet
Step 4. Creating workflow for adding newly approved leave entries into custom form which we created in Step 1
Note: |
1. This workflow helps you to add newly approved leave entries into newly created form automatically |
4.1 Go to Settings --->Tap on "Workflows"

4.2 Tap on "AddWorkflow"

4.3 Select the name of the form and enter the "Workflow name"

4.4 Choose "Approve"

4.5 Tap on "Custom Function"

4.6 Copy paste the code and tap on "Edit Params"

4.7 Give method name, choose form ID and enter argument name as "leave_id"

4.8 Tap on save.Now the workflow will automatically add the approved leave entries into newly created form
